New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

tonal-notation

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tonal-notation

Music notation utilities

  • 0.69.7
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

tonal-notation npm version

tonal

tonal-notation is a collection of functions to create and manipulate strings with music information.

This is part of tonal music theory library.

You can install via npm: npm i --save tonal-notation

API Reference

toStep(letter)Integer

Given a letter, return step

isStep(step)Boolean

Test if a number is a valid step number (a number from 0 to 6)

toLetter(step)String

Given a step, return a letter

areFlats(str)Boolean

Test if a string are all flats (b) chars

areSharps(str)Boolean

Test if a string are all sharps (#) chars

toAlt(accidentals)Integer

Given an accidentals string return its alteration, the number of semitones (positive for sharps, negative for flats, 0 for none)

toAcc(alteration)String

Given an alteration number, returns the accidentals string

toStep(letter) ⇒ Integer

Given a letter, return step

Returns: Integer - the step number (from 0 to 6)

ParamTypeDescription
letterStringthe letter

isStep(step) ⇒ Boolean

Test if a number is a valid step number (a number from 0 to 6)

Returns: Boolean - true if it's a valid step number, false otherwise

ParamTypeDescription
stepIntegerthe step number

toLetter(step) ⇒ String

Given a step, return a letter

Returns: String - the note letter or null if not valid step number

ParamTypeDescription
stepIntegerthe step number

areFlats(str) ⇒ Boolean

Test if a string are all flats (b) chars

Returns: Boolean - true if all charaters are b, false otherwise

ParamTypeDescription
strStringthe string to test

areSharps(str) ⇒ Boolean

Test if a string are all sharps (#) chars

Returns: Boolean - true if all charaters are #, false otherwise

ParamTypeDescription
strStringthe string to test

toAlt(accidentals) ⇒ Integer

Given an accidentals string return its alteration, the number of semitones (positive for sharps, negative for flats, 0 for none)

Returns: Integer - the alteration number of null if not a valid accidental strings

ParamTypeDescription
accidentalsStringthe string to parse

Example

toAlt('###') // => 3
toAlt('bbb') // => -3

toAcc(alteration) ⇒ String

Given an alteration number, returns the accidentals string

Returns: String - the accidental string

ParamTypeDescription
alterationIntegerthe number of semitones (positive and negative values are accepted for sharps and flats)

Example

toAcc(3) // => '###'
toAcc(-3) // => 'bbb'

Keywords

FAQs

Package last updated on 08 Jul 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc